<?php defined('SYS_PATH') or die('No direct script access.');
/**
 * TrueBlood class
 *
 * @author zendzhang<zendzhang@hotmail.com>
 * @version $Id: TrueBlood.php 9 2013-01-14 03:24:50Z zendzhang@hotmail.com $
 */
abstract class TrueBlood
{
    /**
     * Loader
     *
     * @var object
     */
    protected static $load = null;

    /**
     * Set/Get loader
     *
     * @param object $load
     */
    public static function loader($load = null)
    {
        return null === $load ? self::$load : self::$load = $load;
    }

    /**
     * Logs a message to the log file at the given level
     *
     * @param string $message
     * @param int $level
     * @return bool
     */
    protected static function log($level, $message)
    {
        return self::$load->logger->$level($message);
    }

    /**
     * Dynamic get object
     *
     * @param string $key
     */
    public function __get($key)
    {
        if ('load' === $key)
        {
            return $this->load = &self::$load;
        }
        return $this->$key = &$this->load->$key;
    }
}

?>